//#pragma once
#include<iostream>
#include<unistd.h>

class Channel{
public:
	Channel(pid_t pid,int wfd):_who(pid),_wfd(wfd){
		_name="channel-"+std::to_string(_who)+std::to_string(_wfd);
	}

	void SendMassage(int num){
		write(_wfd,&num,sizeof(num));	
	}

	void Close(){
		::close(_wfd);
	}

	pid_t Id(){
		return _who;
	}

	int wFd(){
		return _wfd;
	}

	std::string Name(){
		return _name;
	}

	~ Channel(){}

private:
	pid_t _who;
	int _wfd;
	std::string _name;
};